package c.e.b.h.e.q;

import android.util.Log;
import c.e.b.h.e.k.m0;
import c.e.b.h.e.k.t;
import java.util.ArrayList;
import java.util.List;

/* compiled from: ReportUploader */
public class b {
    public static final short[] h = new short[]{(short) 10, (short) 20, (short) 30, (short) 60, (short) 120, (short) 300};
    public final c.e.b.h.e.q.d.b a;
    public final String b;
    public final String c;
    public final m0 d;
    public final a e;
    public final a f;
    public Thread g;

    /* compiled from: ReportUploader */
    public interface a {
    }

    /* compiled from: ReportUploader */
    public interface b {
    }

    /* compiled from: ReportUploader */
    public interface c {
    }

    /* compiled from: ReportUploader */
    public class d extends c.e.b.h.e.k.d {
        public final List<c.e.b.h.e.q.c.c> a;
        public final boolean b;
        public final float c;

        public d(List<c.e.b.h.e.q.c.c> list, boolean z, float f) {
            this.a = list;
            this.b = z;
            this.c = f;
        }

        public void a() {
            try {
                b(this.a, this.b);
            } catch (Exception e) {
                if (c.e.b.h.e.b.a.a(6)) {
                    Log.e("FirebaseCrashlytics", "An unexpected error occurred while attempting to upload crash reports.", e);
                }
            }
            b.this.g = null;
        }

        public final void b(List<c.e.b.h.e.q.c.c> list, boolean z) {
            c.e.b.h.e.b bVar = c.e.b.h.e.b.a;
            StringBuilder g = c.b.a.a.a.g("Starting report processing in ");
            g.append(this.c);
            g.append(" second(s)...");
            bVar.b(g.toString());
            float f = this.c;
            if (f > 0.0f) {
                try {
                    Thread.sleep((long) (f * 1000.0f));
                } catch (InterruptedException unused) {
                    Thread.currentThread().interrupt();
                    return;
                }
            }
            if (!t.this.p()) {
                int i = 0;
                while (list.size() > 0 && !t.this.p()) {
                    StringBuilder g2 = c.b.a.a.a.g("Attempting to send ");
                    g2.append(list.size());
                    g2.append(" report(s)");
                    bVar.b(g2.toString());
                    ArrayList arrayList = new ArrayList();
                    for (c.e.b.h.e.q.c.c cVar : list) {
                        if (!b.this.a(cVar, z)) {
                            arrayList.add(cVar);
                        }
                    }
                    if (arrayList.size() > 0) {
                        short[] sArr = b.h;
                        int i2 = i + 1;
                        long j = (long) sArr[Math.min(i, sArr.length - 1)];
                        StringBuilder stringBuilder = new StringBuilder();
                        stringBuilder.append("Report submission: scheduling delayed retry in ");
                        stringBuilder.append(j);
                        stringBuilder.append(" seconds");
                        bVar.b(stringBuilder.toString());
                        try {
                            Thread.sleep(j * 1000);
                            i = i2;
                        } catch (InterruptedException unused2) {
                            Thread.currentThread().interrupt();
                            return;
                        }
                    }
                    Object list2 = arrayList;
                }
            }
        }
    }

    public b(String str, String str2, m0 m0Var, a aVar, c.e.b.h.e.q.d.b bVar, a aVar2) {
        this.a = bVar;
        this.b = str;
        this.c = str2;
        this.d = m0Var;
        this.e = aVar;
        this.f = aVar2;
    }

    /* JADX WARNING: Removed duplicated region for block: B:19:0x005f A:{Catch:{ Exception -> 0x0068 }} */
    public boolean a(c.e.b.h.e.q.c.c r6, boolean r7) {
        /*
        r5 = this;
        r0 = c.e.b.h.e.b.a;
        r1 = 1;
        r2 = new c.e.b.h.e.q.c.a;	 Catch:{ Exception -> 0x0068 }
        r3 = r5.b;	 Catch:{ Exception -> 0x0068 }
        r4 = r5.c;	 Catch:{ Exception -> 0x0068 }
        r2.m1828init(r3, r4, r6);	 Catch:{ Exception -> 0x0068 }
        r3 = r5.d;	 Catch:{ Exception -> 0x0068 }
        r4 = c.e.b.h.e.k.m0.ALL;	 Catch:{ Exception -> 0x0068 }
        if (r3 != r4) goto L_0x0018;
    L_0x0012:
        r7 = "Send to Reports Endpoint disabled. Removing Reports Endpoint report.";
        r0.b(r7);	 Catch:{ Exception -> 0x0068 }
        goto L_0x0029;
    L_0x0018:
        r4 = c.e.b.h.e.k.m0.JAVA_ONLY;	 Catch:{ Exception -> 0x0068 }
        if (r3 != r4) goto L_0x002b;
    L_0x001c:
        r3 = r6.e();	 Catch:{ Exception -> 0x0068 }
        r4 = c.e.b.h.e.q.c.c.a.JAVA;	 Catch:{ Exception -> 0x0068 }
        if (r3 != r4) goto L_0x002b;
    L_0x0024:
        r7 = "Send to Reports Endpoint for non-native reports disabled. Removing Reports Uploader report.";
        r0.b(r7);	 Catch:{ Exception -> 0x0068 }
    L_0x0029:
        r7 = 1;
        goto L_0x005d;
    L_0x002b:
        r3 = r5.a;	 Catch:{ Exception -> 0x0068 }
        r7 = r3.a(r2, r7);	 Catch:{ Exception -> 0x0068 }
        r2 = new java.lang.StringBuilder;	 Catch:{ Exception -> 0x0068 }
        r2.<init>();	 Catch:{ Exception -> 0x0068 }
        r3 = "Crashlytics Reports Endpoint upload ";
        r2.append(r3);	 Catch:{ Exception -> 0x0068 }
        if (r7 == 0) goto L_0x0040;
    L_0x003d:
        r3 = "complete: ";
        goto L_0x0042;
    L_0x0040:
        r3 = "FAILED: ";
    L_0x0042:
        r2.append(r3);	 Catch:{ Exception -> 0x0068 }
        r3 = r6.d();	 Catch:{ Exception -> 0x0068 }
        r2.append(r3);	 Catch:{ Exception -> 0x0068 }
        r2 = r2.toString();	 Catch:{ Exception -> 0x0068 }
        r3 = 4;
        r3 = r0.a(r3);	 Catch:{ Exception -> 0x0068 }
        if (r3 == 0) goto L_0x005d;
    L_0x0057:
        r3 = "FirebaseCrashlytics";
        r4 = 0;
        android.util.Log.i(r3, r2, r4);	 Catch:{ Exception -> 0x0068 }
    L_0x005d:
        if (r7 == 0) goto L_0x007d;
    L_0x005f:
        r7 = r5.e;	 Catch:{ Exception -> 0x0068 }
        java.util.Objects.requireNonNull(r7);	 Catch:{ Exception -> 0x0068 }
        r6.remove();	 Catch:{ Exception -> 0x0068 }
        goto L_0x007e;
    L_0x0068:
        r7 = move-exception;
        r1 = new java.lang.StringBuilder;
        r1.<init>();
        r2 = "Error occurred sending report ";
        r1.append(r2);
        r1.append(r6);
        r6 = r1.toString();
        r0.e(r6, r7);
    L_0x007d:
        r1 = 0;
    L_0x007e:
        return r1;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.e.b.h.e.q.b.a(c.e.b.h.e.q.c.c, boolean):boolean");
    }
}
